﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace IslandInterloper.Engine
{
    internal class AvatarSpeed: GameClient
    {
        private string name;
        public string Name
        {
            get
            {
                return name;
            }
        }
        private double factor;
        public double Factor
        {
            get
            {
                return factor;
            }
        }
        internal AvatarSpeed(Game theGame, XElement element)
            : base(theGame)
        {
            FromXElement(element);
        }
        private void FromXElement(XElement element)
        {
            name = element.Element(GameXNames.name).Value;
            factor = Utilities.XElementToDouble(element.Element(GameXNames.factor));
        }
        public override XElement ToXElement(XName xName)
        {
            XElement result = new XElement(xName,
                new XElement(GameXNames.name, name),
                new XElement(GameXNames.factor, factor.ToString())
                );
            return result;
        }
    }
}
